package com.spring.service.impl;

import com.spring.dao.AccountDao;
import com.spring.domain.Account;
import com.spring.service.AccountService;
import com.spring.util.TransactionManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("NoTcfService")
public class AccountServiceNoTCF implements AccountService {
    @Autowired
    private AccountDao accountDao;

    @Override
    public void save(Account account) {
        accountDao.save(account);
    }

    @Override
    public Account findById(int id) {
        return accountDao.findById(id);
    }

    @Override
    public void delById(int id) {
        accountDao.delById(id);
    }

    @Override
    public void transfer(String send, String receive, double money) {
        //业务代码
        accountDao.update(send, 0 - money);
//        int i = 1 / 0;
        accountDao.update(receive, money);
    }
}
